package edu.ahut.designpattern.factory;

public class ShapeFactory {
    public static ShapeFactory getInstance() {
        return instance;
    }

    private static ShapeFactory instance = new ShapeFactory();

    private ShapeFactory() {

    }

    public Shape getShape(String className) {
        Shape shape = null;
        try {
            shape = (Shape) Class.forName(className).newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }


        return shape;
    }
}
